local M = {}
local e = require('utils.editor')
local misc = require('utils.misc')

M.get_config = function()
    return {
        select = {
            enable = true,
            lookahead = true,  -- Move forward for selections
            keymaps = {
                ["af"] = "@function.outer",
                ["aif"] = "@conditional.outer",
                ["alp"] = "@loop.outer",
                ["acls"] = "@class.outer",
            },
        },
    }
end

M.send_key = function(current_line, action)
    if misc.starts_with(current_line,"class") then
        e.send_key('Vacls' .. action)
        return true
    end -- python class

    if misc.starts_with(current_line,"def") then
        e.send_key('Vaf' .. action)
        return true
    end -- python function

    if misc.starts_with(current_line,"for") then
        e.send_key('Valp' .. action)
        return true
    end -- python for loop

    if misc.starts_with(current_line,"if") then
        e.send_key('Vaif' .. action)
        return true
    end -- python code block

    -- Check if the current line ends with ‘[’ or ‘{’ or ‘]’ or ‘}’
    if current_line:match("[%[{]$") or current_line:match("[%]}]$") then
        vim.cmd("normal! V$%" .. action)
        return true
    end

    return false
end

return M
-- EOP
